package game.Menus;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;

import game.ActionListener;
import game.Config.TowerInfo;

/**
 * A tower menu item contains a tower information. It displays the information in tower information when selected.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class TowerMenuItem extends MenuItem{

	TowerInfo info;
	/**
	 * Creates a new TowerMenuItem
	 * @param info The tower information to display.
	 * @param action The action the item will perform when called.
	 */
	public TowerMenuItem(TowerInfo info,ActionListener action) {
		super(action);
		this.info = info;
	}

	@Override
	/**
	 * Prints the item to the screen at a given positon. 
	 * Prints information about its tower info when selected.
	 */
	public void print(Graphics graphic, Vector2f position, boolean selected) {
		if(selected){
			Vector2f newPosition = position.copy().add(new Vector2f(0,this.info.getImage().getHeight()));
			info.displayInfo(newPosition, graphic);
		}
		info.getImage().draw(position.x, position.y);
		
		
	}

}
